Skip to content

Change the rangefinder class to be non-blocking#91

Open
bradamiller wants to merge 3 commits intomainfrom
non-blocking-rangefinder
Open

Change the rangefinder class to be non-blocking#91
bradamiller wants to merge 3 commits intomainfrom
non-blocking-rangefinder

Conversation

@bradamiller
Copy link
Contributor

Summary

  • Refactors the Rangefinder class to use a timer and pin IRQ for non-blocking distance measurements
  • Measurements are taken continuously in the background (60ms cycle), so distance() returns immediately with the most recent value
  • Timeouts are detected without blocking, returning MAX_VALUE (65535) instead of raising exceptions

Test plan

  • Verify distance() returns valid measurements for objects within 2cm-4m range
  • Verify distance() returns MAX_VALUE when no object is in range
  • Verify the first call to distance() blocks until an initial reading is available
  • Verify subsequent calls return immediately without blocking
  • Test that the timer-based approach does not interfere with other XRP subsystems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant